use chrono::prelude::*;
use chrono::Duration;
fn minute_j1(id1:String) ->String {
    let fmt = "%Y-%m-%d %H:%M:%S";
    let result = NaiveDateTime::parse_from_str(id1.as_str(), fmt);
    if result.is_err() {
        result.expect("parse error");
    }
    let date: NaiveDateTime = result.unwrap();
    println!("time: {}, parsed from:'{}'", date, id1);
    let one_minute=Duration::seconds(60);
    println!("one_minute: {}", one_minute);
    return (date+one_minute).format(fmt).to_string();
}
fn test_j1(){
   let s=String::from("2020-06-29 13:25:00");
   let s1=s.clone();
   let j1=minute_j1(s1);
   println!("{}->{}",s,j1);
}
pub fn main(){
    //
    let fmt = "%Y-%m-%d %H:%M:%S";
    //
    let now: DateTime<Local> = Local::now();
    let dft = now.format(fmt);
    let str_date: String = dft.to_string(); // 2021-01-04 20:02:09
    println!("now: {}", str_date);
    //
    let result = NaiveDateTime::parse_from_str(str_date.as_str(), fmt);
    if result.is_err() {
        result.expect("parse error");
    }
    let date: NaiveDateTime = result.unwrap();
    println!("time: {}, parsed from:'{}'", date, str_date);
    test_j1();
}
